//
//  ParentViewController.m
//  PiPiPineapple
//
//  Created by 李晓东 on 17/10/31.
//  Copyright © 2017年 PeanutXu. All rights reserved.
//

#import "ParentViewController.h"
#import "ChildTableViewController.h"
#import "DetailViewController.h"

@interface ParentViewController ()<ChildControllerDelegate>
@property (nonatomic, strong) ChildTableViewController *tableViewController;
@property (nonatomic, strong) DetailViewController *detailViewController;

@end

@implementation ParentViewController

- (void)loadView{
    [super loadView];
    [self.view setBackgroundColor:[UIColor whiteColor]];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self addPhotoDetailsTableView];
    [self addListView];
}

- (void)addPhotoDetailsTableView
{
    ChildTableViewController *details = [[ChildTableViewController alloc] init];
    [self addChildViewController:details];
    CGRect frame = self.view.bounds;
    frame.origin.x = 150;
    frame.size.width = self.view.bounds.size.width - 150;
    details.view.frame = frame;
    [self.view addSubview:details.view];
    [details setDelegate:self];
}

- (void)addListView{
    self.detailViewController = [[DetailViewController alloc]init];
    [self addChildViewController:self.detailViewController];
    CGRect frame = self.view.bounds;
    frame.size.width = 149;
    [self.detailViewController.view setFrame:frame];
    [self.view addSubview:self.detailViewController.view];
    
}

- (void)didSelectedAttributeWithKey:(NSString *)key{
    NSLog(@"fuck me-%@", key);
    [self.detailViewController drawSomeText:key];
}

@end
